﻿<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="NhomVaDoiTac.aspx.cs" Inherits="ThuChi.NhomVaDoiTac" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style9
        {
            width: 657px;
        }
        .style12
        {
            width: 552px;
        }
        .style13
        {
            width: 665px;
        }
        .style16
        {
            width: 116px;
        }
        .style17
        {
            width: 552px;
            text-align: center;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server" />
    <asp:LinqDataSource ID="LinqDataSourceNhom" runat="server" 
        ContextTypeName="ThuChi.DCThuChiDataContext" EntityTypeName="" 
        TableName="Nhoms" 
        Where="MaTaiKhoan == @MaTaiKhoan" EnableDelete="True" EnableInsert="True" 
            EnableUpdate="True" onselecting="LinqDataSourceNhom_Selecting">
        <InsertParameters>
            <asp:SessionParameter DefaultValue="0" Name="MaTaiKhoan" 
                SessionField="MaTaiKhoan" Type="Int32" />
        </InsertParameters>
        <WhereParameters>
            <asp:SessionParameter DefaultValue="0" Name="MaTaiKhoan" 
                SessionField="MaTaiKhoan" Type="Int32" />
        </WhereParameters>
    </asp:LinqDataSource>
    <asp:LinqDataSource ID="LinqDataSourceDoiTac" runat="server" 
        ContextTypeName="ThuChi.DCThuChiDataContext" EntityTypeName="" 
        TableName="DoiTacs" 
        Where="MaNhom == @MaNhom" EnableDelete="True" EnableInsert="True" 
            EnableUpdate="True" onselecting="LinqDataSourceDoiTac_Selecting">
        <InsertParameters>
            <asp:SessionParameter DefaultValue="0" Name="MaNhom" SessionField="MaNhom" 
                Type="Int32" />
        </InsertParameters>
        <WhereParameters>
            <asp:SessionParameter DefaultValue="0" Name="MaNhom" 
                SessionField="MaNhom" Type="Int32" />
        </WhereParameters>
    </asp:LinqDataSource>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <table style="border: 2px solid #dbddff; width: 100%;" cellpadding="4" 
        width="100%" border="2px" align="center" bgcolor="Snow">
        <tr>
            <td colspan="2" valign="middle" width="100%" align="center">
                <strong>QUẢN LÝ NHÓM VÀ ĐỐI TÁC</strong></td>
        </tr>
        <tr>
            <td class="style12" valign="top" style="border: thin solid #dbddff;">
                <asp:Label ID="lblNhomErrorMessage" runat="server" ForeColor="Red" Width="100%" 
                    style="margin-left: 6px"></asp:Label>
            </td>
            <td class="style13" valign="top" style="border: thin solid #dbddff;">
                <asp:Label ID="lblDoiTacErrorMessage" runat="server" ForeColor="Red" Width="100%" 
                    style="margin-left: 6px"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style12" valign="top" style="border: 2px solid #dbddff;" 
                align="left">
                <asp:DetailsView ID="DetailsViewNhom" runat="server" AutoGenerateRows="False" 
                    BorderColor="#DBDDFF" BorderStyle="Solid" BorderWidth="2px" CellPadding="4" 
                    CellSpacing="2" DataKeyNames="MaNhom" DataSourceID="LinqDataSourceNhom" 
                    DefaultMode="Insert" Height="50px" 
                    oniteminserted="DetailsViewNhom_ItemInserted" Width="100%">
                    <Fields>
                        <asp:BoundField DataField="TenNhom" HeaderText="Tên nhóm" 
                            SortExpression="TenNhom">
                        <ControlStyle Width="99%" />
                        <HeaderStyle ForeColor="Blue" Width="50px" Wrap="False" />
                        <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Wrap="False" />
                        </asp:BoundField>
                        <asp:CommandField CancelText="Hủy bỏ" InsertText="Thêm" 
                            ShowInsertButton="True" />
                        <asp:DynamicField DataField="MaTaiKhoan" HeaderText="MaTaiKhoan" 
                            ReadOnly="True" Visible="False" />
                    </Fields>
                    <HeaderStyle Wrap="True" />
                    <InsertRowStyle BorderColor="Lavender" BorderStyle="Solid" BorderWidth="1px" />
                    <RowStyle BorderColor="#DBDDFF" BorderStyle="Solid" BorderWidth="1px" />
                </asp:DetailsView>
            </td>
            <td class="style13" valign="top" style="border: thin solid #dbddff;">
                <asp:DetailsView ID="DetailsViewDoiTac" runat="server" AutoGenerateRows="False" 
                    BorderColor="#DBDDFF" BorderStyle="Solid" BorderWidth="2px" CellPadding="4" 
                    CellSpacing="2" DataKeyNames="MaDoiTac" DataSourceID="LinqDataSourceDoiTac" 
                    DefaultMode="Insert" Height="50px" 
                    oniteminserted="DetailsViewDoiTac_ItemInserted" Width="100%">
                    <Fields>
                        <asp:BoundField DataField="TenDoiTac" HeaderText="Tên đối tác" 
                            SortExpression="TenDoiTac">
                        <ControlStyle Width="99%" />
                        <HeaderStyle ForeColor="Blue" Width="50px" Wrap="False" />
                        <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Wrap="False" />
                        </asp:BoundField>
                        <asp:CommandField CancelText="Hủy bỏ" InsertText="Thêm" 
                            ShowInsertButton="True" />
                        <asp:DynamicField DataField="MaNhom" HeaderText="MaNhom" ReadOnly="True" 
                            Visible="False" />
                    </Fields>
                    <HeaderStyle Wrap="True" />
                    <InsertRowStyle BorderColor="Lavender" BorderStyle="Solid" BorderWidth="1px" />
                    <RowStyle BorderColor="#DBDDFF" BorderStyle="Solid" BorderWidth="1px" />
                </asp:DetailsView>
            </td>
        </tr>
        <tr>
            <td class="style12" valign="top" style="border: 2px solid #dbddff;">
                <asp:GridView ID="grvNhom" runat="server" AllowPaging="True" Width="100%" 
                    AllowSorting="True" AutoGenerateColumns="False" CellPadding="6" 
                    CssClass="DDGridView" 
                    EnableModelValidation="False" 
                    ShowFooter="True" ShowHeaderWhenEmpty="True" 
                    DataSourceID="LinqDataSourceNhom" DataKeyNames="MaNhom" onrowdatabound="grvNhom_RowDataBound" 
                                    onrowdeleted="grvNhom_RowDeleted" 
                                    onselectedindexchanged="grvNhom_SelectedIndexChanged" 
                    onprerender="grvNhom_PreRender" SelectedIndex="0">
                    <Columns>
                        <asp:CommandField CancelText="Hủy bỏ" DeleteText="Xóa" EditText="Sửa" 
                            InsertText="Thêm" NewText="Tạo mới" SelectText="Chọn" ShowDeleteButton="True" 
                            ShowEditButton="True" ShowSelectButton="True" 
                            UpdateText="Cập nhật">
                        <FooterStyle Wrap="False" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="110px" 
                            Wrap="False" />
                        </asp:CommandField>
                <asp:BoundField DataField="TenNhom" HeaderText="Tên nhóm" 
                            SortExpression="TenNhom" >
                        </asp:BoundField>
                        <asp:BoundField DataField="Ton" HeaderText="Tồn" 
                            SortExpression="Ton" DataFormatString="{0:N0}" ReadOnly="True" >
                        </asp:BoundField>
                        <asp:DynamicField DataField="MaTaiKhoan" HeaderText="MaTaiKhoan" 
                            ReadOnly="True" Visible="False" />
                    </Columns>
                    <FooterStyle CssClass="DDFooter" />
                    <HeaderStyle HorizontalAlign="Center" CssClass="th" />
                    <PagerSettings FirstPageImageUrl="~/DynamicData/Content/Images/PgFirst.gif" 
                        FirstPageText="" LastPageImageUrl="~/DynamicData/Content/Images/PgLast.gif" 
                        LastPageText="" Mode="NumericFirstLast" NextPageText="" PageButtonCount="8" 
                        PreviousPageText="" />
                    <PagerStyle CssClass="DDPager" HorizontalAlign="Left" VerticalAlign="Middle" />
                    <RowStyle CssClass="td" />
                    <SelectedRowStyle CssClass="DDSelected" />
                </asp:GridView>
            </td>
            <td class="style13" valign="top" style="border: 2px solid #dbddff;">
                <asp:GridView ID="grvDoiTac" runat="server" AllowPaging="True" Width="100%" 
                    AllowSorting="True" AutoGenerateColumns="False" CellPadding="6" 
                    CssClass="DDGridView" 
                    EnableModelValidation="False" 
                    ShowFooter="True" ShowHeaderWhenEmpty="True" 
                    DataSourceID="LinqDataSourceDoiTac" DataKeyNames="MaDoiTac" onrowdatabound="grvDoiTac_RowDataBound" 
                                    onrowdeleted="grvDoiTac_RowDeleted" 
                    SelectedRowStyle-CssClass="DDSelected" onprerender="grvDoiTac_PreRender">
                    <Columns>
                        <asp:CommandField DeleteText="Xóa" EditText="Sửa" InsertText="Thêm" 
                            NewText="Tạo mới" SelectText="Chọn" ShowDeleteButton="True" 
                            ShowEditButton="True" UpdateText="Cập nhật" CancelText="Hủy bỏ">
                        <FooterStyle Wrap="False" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="80px" 
                            Wrap="False" />
                        </asp:CommandField>
                <asp:BoundField DataField="TenDoiTac" HeaderText="Tên đối tác" 
                            SortExpression="TenDoiTac" >
                        </asp:BoundField>
                        <asp:BoundField DataField="Ton" HeaderText="Tồn" 
                            SortExpression="Ton" ReadOnly="True" DataFormatString="{0:N0}" >
                        </asp:BoundField>
                    </Columns>
                    <FooterStyle CssClass="DDFooter" />
                    <HeaderStyle HorizontalAlign="Center" CssClass="th" />
                    <PagerSettings FirstPageImageUrl="~/DynamicData/Content/Images/PgFirst.gif" 
                        FirstPageText="" LastPageImageUrl="~/DynamicData/Content/Images/PgLast.gif" 
                        LastPageText="" Mode="NumericFirstLast" NextPageText="" PageButtonCount="8" 
                        PreviousPageText="" />
                    <PagerStyle CssClass="DDPager" HorizontalAlign="Left" VerticalAlign="Middle" />
                    <RowStyle CssClass="td" />
                    <SelectedRowStyle BackColor="#0099FF" ForeColor="White" />
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td valign="top" style="border: 2px solid #dbddff;">
                Hiển thị:&nbsp;<asp:DropDownList ID="cboNhomPageSize" runat="server" AutoPostBack="True" 
                    Width="45px" 
                    Height="20px" 
                    style="margin-right: 0px; margin-left: 0px;" Font-Size="13px" 
                    onselectedindexchanged="cboNhomPageSize_SelectedIndexChanged">
                    <asp:ListItem>1</asp:ListItem>
                    <asp:ListItem Selected="True">5</asp:ListItem>
                    <asp:ListItem>10</asp:ListItem>
                    <asp:ListItem>20</asp:ListItem>
                    <asp:ListItem>50</asp:ListItem>
                    <asp:ListItem>30</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td class="style16" valign="top" style="border: 2px solid #dbddff;">
                Hiển thị:&nbsp;<asp:DropDownList ID="cboDoiTacPageSize" runat="server" AutoPostBack="True" 
                    Width="45px" 
                    Height="20px" 
                    style="margin-right: 0px; margin-left: 0px;" 
                    CssClass="style9" Font-Size="13px" 
                    onselectedindexchanged="cboDoiTacPageSize_SelectedIndexChanged">
                    <asp:ListItem>1</asp:ListItem>
                    <asp:ListItem Selected="True">5</asp:ListItem>
                    <asp:ListItem>10</asp:ListItem>
                    <asp:ListItem>20</asp:ListItem>
                    <asp:ListItem>30</asp:ListItem>
                    <asp:ListItem>50</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
    </table>
    </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
